<template>
	<view class="post-item-content" @click.stop="tap">
		<u-button type="success" @click="clkFollow(itemData)" :ripple="true" :hair-line=false
			:class="isFollowed?'btn-nofollow':'btn-follow'">
			{{!isFollowed?'关注':(type == 1?'已关注':'取消关注')}}
		</u-button>
	</view>
</template>

<script>
	export default {
		name: "u-follow-button",
		data() {
			return {};
		},
		props: {
			// 是否已经关注过了
			isFollowed: { 
				type: Boolean,
				default: false
			},
			// 类型[1:已关注就显示已关注, 2：已关注可以取消关注]
			type: {
				type: Number,
				default: 1
			},
			itemData: {
				type: Object,
				default () {
					return {
						title: '陆小凤',
						imgUrl: "https://p.ssl.qhimg.com/t0106f6b6c0a2f68a42.jpg",
						dateTime: 215635212,
						majorStr: '专业A,专业B,专业C',
						info: "三星（SAMSUNG）R "
					}
				}
			},
		},
		onLoad() {},
		methods: {
			clkClose() {
				this.$emit('closeAd');
			},
			tap() {
				console.log('阻止冒泡')
			},
			clkFollow(itemData) {
				this.$emit("clkFollow", itemData)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.btn-follow {
			
		width: 115rpx;
		height: 40rpx;
		background: #3FA7FF;
		box-shadow: -4rpx -4rpx 12rpx #FFFFFF;
		opacity: 1;
		border: 0;
		border-radius: 8rpx;

		font-size: 23rpx;
		font-family: SimHei;
		font-weight: 400;
		line-height: 31rpx;
		color: #E9EBF4;
		opacity: 1;

		// background: #E9EBF4;
	}

	.btn-nofollow {
		width: 115rpx;
		height: 40rpx;
		background: #E9EBF4;
		box-shadow: -4rpx -4rpx 12rpx #FFFFFF;
		opacity: 1;
		border-radius: 8rpx;
		border: 0;

		font-size: 23rpx;
		font-family: SimHei;
		font-weight: 400;
		line-height: 31rpx;
		color: #4D5B80;
		opacity: 1;

		// background: #E9EBF4;
	}
</style>
